<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<style type="text/css">
.ui-jqgrid-resize-mark {
	display: none
}

.ui-jqgrid-bdiv tr.ui-row-ltr {
	height: 30px;
}
</style>
<table id="${ctId}">
	<tbody>
		<tr>
			<td>
			<td />
		</tr>
	</tbody>
</table>

<c:if test="${showPager ne false }">
	<div id="${ctId}Pager"></div>
</c:if>

<script type="text/javascript"> 
	var  ${ctId}={};
	function getSelectedValue() {
		var multiselect=${multiselect};
		var selectedRows = new Array();
		if (multiselect) {
			var selectedIds = $("#${ctId}").jqGrid("getGridParam",
					"selarrrow");
			$(selectedIds).each(function(index, item) {
				selectedRows.push($("#${ctId}").jqGrid(
						"getRowData", item));

			});

		} else {
			var selrow = $("#${ctId}").jqGrid("getGridParam",
					"selrow");

			selectedRows.push($("#${ctId}").jqGrid("getRowData",
					selrow));

		}
	  return selectedRows;
	}

	 ${ctId}.reload=function(){
		 $("#${ctId}").jqGrid().trigger("reloadGrid",[{page:1}]); 
	 }
	  
	
	 ${ctId}.jqGrid = $("#${ctId}").jqGrid({
		url : '${url}',
		datatype : "json",
		mtype : "GET",//提交方式
		autowidth : true,
		width:"auto",
		height:${dheight-145},
		colNames:[${colNames}],
		colModel:[${colModel}],
		rowList:[10,15,20,30],
		rowNum:${rowNum},
		rownumbers:true,
		viewrecords: true,
		forceFit:true,
		altRows:true,
		multiselect:${multiselect},
		postData:{pageable:${showPager}${selectColumns}},
		jsonReader:{
	           repeatitems : false,root:"content"
	    },
	    loadComplete:function(data){ 
	    	$(this).jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false,defaultSearch:'cn'});
	    },
	    ondblClickRow:function(rowid,iRow,iCol,e){
	    	var multiselect=${multiselect};
	    	if(!multiselect){
	    		var rowData = ${ctId}.jqGrid.jqGrid('getRowData',rowid);
	    		window.parent.${ctId}Selector.setSelected([rowData]);
	    		window.parent.${ctId}Selector.closeDialog();
	    	}
	    },
	    pager:$("#${ctId}Pager"),  
	    toppager:false,
        cloneToTop:true
	});
</script>
